home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 4 / MacMania 4.toast / / Demo's / Igor Demo Pro / 1 PutContentsIn Igor Pro Folder / WaveMetrics Procedures / Annotations / AnnotationInfo Procs next >
Text File  |  1995-12-31  |  3KB  |  106 lines

  1. #pragma rtGlobals=1
  2.  
  3. // Version 1.10: Added support for XWAVEDF, YWAVEDF and AXISZ keywords.
  4.  
  5. //    AnnotationInfo Procedures
  6. //
  7. //    These functions can be used to find information about a tag, textbox or legend in a graph
  8. //    or page layout window.
  9. //
  10. //    Example:
  11. //        String infoStr = AnnotationInfo("Graph0", "text0")
  12. //        Print AnnotationYWave(infoStr), AnnotationAttachX(infoStr)
  13.  
  14. Function/S ExtractAIField(packedStr, keyStr)
  15.     String packedStr, keyStr
  16.     
  17.     Variable startPos, endPos
  18.     
  19.     startPos = strsearch(packedStr, keyStr, 0) + strlen(keyStr)
  20.     if (CmpStr(keyStr, "TEXT:") == 0)        // TEXT is always the LAST keyword in packedStr
  21.         endPos = strlen(packedStr)
  22.     else
  23.         endPos = strsearch(packedStr, ";", startPos) - 1
  24.     endif
  25.  
  26.     return packedStr[startPos, endPos]
  27. End
  28.  
  29. Function/S AnnotationType(infoStr)
  30.     String infoStr                    // infoStr is the output from AnnotationInfo function
  31.     
  32.     return ExtractAIField(infoStr, "TYPE:")
  33. End
  34.  
  35. Function/S AnnotationFlags(infoStr)
  36.     String infoStr                    // infoStr is the output from AnnotationInfo function
  37.     
  38.     return ExtractAIField(infoStr, "FLAGS:")
  39. End
  40.  
  41. Function/S AnnotationXWave(infoStr)
  42.     String infoStr                    // infoStr is the output from AnnotationInfo function
  43.     
  44.     return ExtractAIField(infoStr, "XWAVE:")
  45. End
  46.  
  47. Function/S AnnotationYWave(infoStr)
  48.     String infoStr                    // infoStr is the output from AnnotationInfo function
  49.     
  50.     return ExtractAIField(infoStr, "YWAVE:")
  51. End
  52.  
  53. Function/S AnnotationXWaveDataFolder(infoStr)        // Added in version 1.10
  54.     String infoStr                    // infoStr is the output from AnnotationInfo function
  55.     
  56.     return ExtractAIField(infoStr, "XWAVEDF:")
  57. End
  58.  
  59. Function/S AnnotationYWaveDataFolder(infoStr)        // Added in version 1.10
  60.     String infoStr                    // infoStr is the output from AnnotationInfo function
  61.     
  62.     return ExtractAIField(infoStr, "YWAVEDF:")
  63. End
  64.  
  65. Function/D AnnotationAttachX(infoStr)
  66.     String infoStr                    // infoStr is the output from AnnotationInfo function
  67.  
  68.     return str2num(ExtractAIField(infoStr, "ATTACHX:"))
  69. End
  70.  
  71. Function/D AnnotationAbsX(infoStr)    
  72.     String infoStr                    // infoStr is the output from AnnotationInfo function
  73.  
  74.     return str2num(ExtractAIField(infoStr, "ABSX:"))
  75. End
  76.  
  77. Function/D AnnotationAbsY(infoStr)    
  78.     String infoStr                    // infoStr is the output from AnnotationInfo function
  79.  
  80.     return str2num(ExtractAIField(infoStr, "ABSY:"))
  81. End
  82.  
  83. Function/D AnnotationAxisX(infoStr)    
  84.     String infoStr                    // infoStr is the output from AnnotationInfo function
  85.  
  86.     return str2num(ExtractAIField(infoStr, "AXISX:"))
  87. End
  88.  
  89. Function/D AnnotationAxisY(infoStr)    
  90.     String infoStr                    // infoStr is the output from AnnotationInfo function
  91.  
  92.     return str2num(ExtractAIField(infoStr, "AXISY:"))
  93. End
  94.  
  95. Function/D AnnotationAxisZ(infoStr)        // Added in version 1.10
  96.     String infoStr                    // infoStr is the output from AnnotationInfo function
  97.  
  98.     return str2num(ExtractAIField(infoStr, "AXISZ:"))
  99. End
  100.  
  101. Function/S AnnotationText(infoStr)    
  102.     String infoStr                    // infoStr is the output from AnnotationInfo function
  103.  
  104.     return ExtractAIField(infoStr, "TEXT:")
  105. End
  106.